<template>
  <a-card :bordered="false">
    <div class="table-page-search-wrapper">
      <!--<a-form layout="inline"  @keyup.enter.native="">-->
        <!--<a-row :gutter="12">-->
          <!--<a-col :md="7" :sm="8">-->
            <!--<a-form-item label="用户类型" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">-->
              <!--<a-input placeholder="请选择用户类型" v-model="queryParam.userType"></a-input>-->
            <!--</a-form-item>-->
          <!--</a-col>-->
          <!--<a-col :md="7" :sm="8">-->
            <!--<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
              <!--<a-button type="primary"  @click="searchQuery" icon="search">查询</a-button>-->
              <!--<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
            <!--</span>-->
          <!--</a-col>-->
        <!--</a-row>-->
      <!--</a-form>-->

      <div class="table-operator" style="border-top: 5px">
        <a-button type="primary" @click="handleAdd">新增</a-button>
      </div>
      <a-table
        ref="table"
        rowKey="id"
        size="middle"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
          <span  slot="userType" slot-scope="text, record">
             <span>{{record.userType==0?"非会员":"会员"}}</span>
        </span>
        <span  slot="hourAndDay" slot-scope="text, record">
             <span>{{record.hourAndDay==0?"天":"小时"}}</span>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">
            <a-icon type="edit"/>
            编辑
          </a>
          <a-divider type="vertical"/>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() =>handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <bladeFeeDeduction-Modal ref='modalForm' @ok="modalFormOk"></bladeFeeDeduction-Modal>
  </a-card>
</template>

<script>
import { listBladeFeeDeduction, delBladeFeeDeduction} from "@/api/umbrella/BladeFeeDeduction";
import { filterObj } from '@/utils/util';
import { UmbrellaListMixin } from '@/mixins/UmbrellaListMixin'
import bladeFeeDeductionModal from '../modules/bladeFeeDeductionModal'
export default {
  name: "bladeFeeDeduction",
  components: {bladeFeeDeductionModal},
  mixins:[UmbrellaListMixin],
  data() {
    return {
      // 查询参数
      queryParam:{
        current: 1,
        size: 10,
      },
      // 表头
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 120,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '用户类型',
          align: "center",
          dataIndex: 'userType',
          scopedSlots: {customRender: 'userType'},
        },
        {
          title: '时间类型(天)',
          align: "center",
          dataIndex: 'hourAndDay',
          scopedSlots: {customRender: 'hourAndDay'},
        },
        {
          title: '借用时长(1D-7D)',
          align: "center",
          dataIndex: 'borrowingTime',
        },
        {
          title: '对应金额',
          align: "center",
          dataIndex: 'borrowingMoney',
        },
        {
          title: '对应积分',
          align: "center",
          dataIndex: 'borrowingIntegral',
        },
        {
          title: '创建时间',
          align: "center",
          dataIndex: 'createTime',
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          scopedSlots: {customRender: 'action'},
        }
      ],
      // 数据 -- 表格
      dataSource:[],
      // loading 是否显示  请求表格列表之前 设置为true   请求结束设置为false
      loading:false,
      url: {
        list: "/api/gateway/jic-backend-activity/BladeFeeDeduction/list",
        delete: "/api/gateway/jic-backend-activity/BladeFeeDeduction/remove",
      },
    };
  },
  created() {
    // this.getList();
  },

  methods: {
    getQueryParams() {
      var param = Object.assign({}, this.queryParam);
      param.current = this.ipagination.current;
      param.pageSize = this.ipagination.pageSize;
      return filterObj(param);
    },
    // 重置搜索框的内容
    searchReset() {
      var that = this;
       that.loadData(this.ipagination.current);
    },

  }
};
</script>
